#include"comm.hpp"
#include"log.hpp"
#include<string>
using namespace std;

int main()
{
    //测试可变参数
    // cout<<sum(1,10)<<endl;
    // cout<<sum(2,10,20)<<endl;
    // cout<<sum(3,10,20,30)<<endl;
    
    // logmessage(Info,"hello");

    Log log;
    int fd = open(FIFO_FILE,O_WRONLY);
    if(fd < 0)
    {
        // perror("open:");
        log.printmethod(Classfile);
        log.logmessage(Fatal,"error string:%s,error code:%d",strerror(errno),errno);
        exit(FIFO_OPEN_ERR);
    }
    cout<<"client open:"<<endl;
    string line;
    while(true)
    {
        cout << "Please Enter@ ";
        // cin >> line;
        getline(cin,line);

        write(fd,line.c_str(),line.size());
    }

    close(fd);
    return 0;
}